#pragma comment(linker, "/STACK:10000000")
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#include <cassert>
#include <string>
#include <cstring>
#define ldb long double
#define ll long long
#define fi first
#define se second
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define fill(a, c) memset(a, c, sizeof(a))
#define sqr(a) ((a) * (a))
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define getBit(mask, k) (((mask) / pw[k]) % pw[1])
#define setBit(mask, k, l) (((mask) / pw[k + 1] * pw[1] + (l)) * pw[k] + ((mask) % pw[k]))
#define debug(a) cerr << #a << " = " << (a) << " ";
#define debugl(a) cerr << #a << " = " << (a) << "\n";
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define ff first
#define ss second 
const ldb eps = 1e-9;
const int inf = 1 << 28;
const ldb pi = fabsl(atan2l(0.0, -1.0));
using namespace std;

int n;
ldb a[1230], d;


void load()
{
	cin >> n >> a[1];
	cin >> a[n] >> d;
	a[2] = ((ldb)a[n] + (ldb)(n - 2) * a[1] + (ldb)(n - 1) * (n - 2) * d) / ((ldb)n - 1);
	for (int i = 3; i < n; i++)
	{
		a[i] = (i - 1) * a[2] - (i - 1) * (i - 2) * d - (i - 2) * a[1];
	}
	int I, J, K;
	cin >> I >> J >> K;
	cout << setprecision(8) << fixed << a[I] + a[J] + a[K];
}

void solve()
{

}

#define file "baba"
int main()
{
	freopen(file".in", "rt", stdin);
	freopen(file".out", "wt", stdout);
	load();
	solve();
	return 0;
}
